<template>
  <div class="tree-wrap">
    <div v-for="(item,index) in data" :key="index">
      <div @click="getchildren($event)" ref="dataItem" :data-item="item">
        
        {{ item.title }}

      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Tree',
  data(){
    return {
      data:[
        {
          title:"自行车",
          children:[
            {
              title:"自行车2",
              children:[]
            },
            {
              title:"自行车2",
              children:[]
            },
            {
              title:"自行车2",
              children:[]
            },
            {
              title:"自行车2",
              children:[]
            }
          ]
        },
        {
          title:"自行车",
          children:[]
        },
        {
          title:"自行车",
          children:[]
        }
      ]
    }
  },
  methods:{
    getchildren(){
      console.log(this.$refs)
    }
  }
}
</script>
<style scoped></style>
